﻿using System;
using System.Collections.Generic;
using System.Text;
using DTO;
using System.Data;
using System.Data.SqlClient;

namespace DAO
{
    public class BacSiDAO
    {
        public static List<BacSiDTO> SelectBacSiByAll()
        {
            List<BacSiDTO> list = new List<BacSiDTO>();
            try
            {
                // Create List Sql Parameter
                List<SqlParameter> sqlParams = new List<SqlParameter>();
                DataTable dt = SqlDataAccessHelper.ExecuteQuery("usp_SelectBacSiAll", sqlParams);
                foreach (DataRow dr in dt.Rows)
                {
                    BacSiDTO bacsi = new BacSiDTO();
                    bacsi.Ma = int.Parse(dr["Ma"].ToString());
                    bacsi.Hoten = dr["HoTen"].ToString();                    
                    list.Add(bacsi);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return list;
        }

       
    }
}
